﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AMS.Chess.CommonLayer
{
    public class StandardBoardPosition : ABoardPosition
    {
        private int _rank;
        public int Rank
        {
            get { return _rank; }
            set { _rank = value; }
        }

        private char _file;
        public char File
        {
            get { return _file; }
            set { _file = char.ToLower(value); }
        }

        public StandardBoardPosition(int rank, char file)
            : base()
        {
            Rank = rank;
            File = file;
        }

        public static bool operator == (StandardBoardPosition a, StandardBoardPosition b)
        {
            if (Object.Equals(a, null) || Object.Equals(b, null))
            //if (a.Equals(null) || b.Equals(null))
            {
                //if (a.Equals(null) && b.Equals(null))
                if (Object.Equals(a, null) && Object.Equals(b, null))
                    return true;
                else
                    return false;
            }

            return a.File == b.File && a.Rank == b.Rank;
        }

        public static bool operator != (StandardBoardPosition a, StandardBoardPosition b)
        {
            return !(a == b);
        }
    }
}
